audio_form object

This method will create a checkbox and return a control ID.

int create_checkbox(string caption, bool initial_value=false, bool read_only=false)

Parameters:
caption
The text for the checkbox.
initial_value
An optional parameter specifying the initial value for the checkbox. true is checked, false is unchecked.
read_only
An optional parameter indicating whether the checkbox should be read only. true means the checkbox will be read only, false means it can be modified.

Return value:
A control ID that can be used to check the status of the control, or -1 on error.

Remarks:
Prepending any letter in the caption string with an ampersand (&) sign will cause a shortcut to be created for the checkbox. For example, &Subscribe will cause alt+s to be the shortcut for the Subscribe checkbox.

Example:
// Make a simple form with a few buttons and a checkbox.

#include "form.bgt"

audio_form form;

void main()
{
form.create_window("Example Form", true);
int subscribe=form.create_checkbox("&Subscribe", false, false);
int ok=form.create_button("OK");
int cancel=form.create_button("E&xit");
while(true)
{
form.monitor();
wait(5);
if(form.is_pressed(ok))
{
exit();
}
if(form.is_pressed(cancel))
{
exit();
}
if((key_down(KEY_LMENU))&&(key_pressed(KEY_F4)))
{
exit();
}
}
}